﻿<%@ Page Title="Danh sách tài khoản" Language="C#" MasterPageFile="~/App_MasterPages/Aquarius.Master"
    AutoEventWireup="true" CodeBehind="Warning_AccountManagement.aspx.cs" Inherits="AlertSystem.Web.Warning_AccountManagement"  %>

<%@ Register Src="../UserControl/ucPaging.ascx" TagName="ucPaging" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CssContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            RegisterDialog();
            ComboBox("ddlSearchOrganization_Id,ddlOrganization_Id");
        });

        function SetNew() {
            ResetControl("pnl_dialog1");
            $("[id$=txtAccount_Id]").prop("disabled", false);
            $("[id$=hdfAction]").val("AddNew");
            OpenDialog('dialog1', 600);
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-grid">
                </div>
                <h1>Điều kiện tìm kiếm</h1>
                <div class="clear"></div>
            </div>
            <div class="block-fluid" style="padding: 10px 0px 5px 10px">
                <table width="100%" cellspacing="0" cellpadding="0" class="">
                    <tbody>
                        <tr>
                            <td style="width:100px">Account ID</td>
                            <td style="width:200px"><asp:TextBox ID="txtSearchAccount_Id" runat="server"/></td>
                            <td style="width:100px">Full Name</td>
                            <td style="width:200px"><asp:TextBox ID="txtSearchFull_Name" runat="server"/></td>
                            <td style="width:100px">Organization</td>
                            <td style="width:200px"><asp:DropDownList ID="ddlSearchOrganization_Id" runat="server"/></td>
                        </tr>
                        <tr>
                            <td style="width:100px">Description</td>
                            <td style="width:200px"><asp:TextBox ID="txtSearchDescription" runat="server"/></td>
                        </tr>
                    </tbody>
                </table>
                <div style="text-align: center">
                    <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" OnClick="btnSearch_Click"
                        CssClass="btn" />
                </div>
            </div>
        </div>
    </div>
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-grid"></div>
                <h1>Danh sách tài khoản</h1>
                <ul class="buttons">
                    <li><a href="javascript:SetNew();" class="isw-plus" id="lbtnAddNew" title="Thêm mới dữ liệu"></a></li>
                </ul>
                <div class="clear">
                </div>
            </div>
            <div class="block-fluid table-sorting">
                <div class="dataTables_wrapper" id="tSortable_wrapper">
                    <div class="dataTables_length">
                        <label>
                            Hiển thị
                            <asp:DropDownList ID="tSortable_length" size="1" aria-controls="tSortable" runat="server"
                                OnSelectedIndexChanged="tSortable_length_SelectedIndexChanged" AutoPostBack="true">
                                <asp:ListItem Value="50" Selected="True" />
                                <asp:ListItem Value="100" />
                                <asp:ListItem Value="200" />
                                <asp:ListItem Value="250" />
                                <asp:ListItem Value="300" />
                                <asp:ListItem Value="400" />
                                <asp:ListItem Value="500" />
                            </asp:DropDownList>
                            dòng</label>
                    </div>
                    <div>
                        <uc1:ucPaging ID="pagingtop" runat="server" />
                    </div>
                    <asp:GridView ID="grvData" CssClass="table2 dataTable" runat="server" 
                        AutoGenerateColumns="false" Width="100%" ShowHeaderWhenEmpty="true" onrowcommand="grvData_RowCommand">
                        <Columns>
                            <asp:TemplateField HeaderText="STT" ItemStyle-CssClass="STT">
                                <ItemTemplate>
                                    <%#(Container.DataItemIndex + 1) + (pagingtop.CurrentPage - 1) * pagingtop.PageSize%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField HeaderText="Account ID" DataField="Account_Id" />
                            <asp:BoundField HeaderText="Full Name" DataField="Full_Name" />
                            <asp:TemplateField HeaderText="ShortCode">
                                <ItemTemplate>
                                    <%# Warning_Organization.GetNameByID(DB, Eval("Organization_Id").ToString().ToInt())%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField HeaderText="Description" DataField="Description" />
                            <asp:TemplateField HeaderText="Chức năng" ItemStyle-CssClass="Function">
                                <ItemTemplate>
                                    <asp:LinkButton Text="Sửa" CommandArgument='<%#Eval("Account_Id")%>' CommandName="Editing" runat="server" />
                                    &nbsp;
                                    <asp:LinkButton Text="Xóa" CommandArgument='<%#Eval("Account_Id")%>' CommandName="Deleting" runat="server" OnClientClick="return confirm('Bạn có chắc chắn muốn xóa không?');"/>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <div class="dataTables_info" id="tSortable_info">
                        <asp:Literal ID="ltrInfo" runat="server" />
                    </div>
                    <div class="dataTables_paginate paging_full_numbers" id="tSortable_paginate">
                        <uc1:ucPaging ID="pagingbottom" runat="server" />
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
        </div>
    </div>

    <div class="dialog" id="dialog1" title="Thông tin tài khoản" style="display: none;">
        <asp:Panel ID="pnl_dialog1" runat="server" CssClass="block">
            <asp:HiddenField ID="hdfID" Value="" runat="server" />
            <asp:HiddenField ID="hdfAction" Value="" runat="server" />
            <table width="100%" cellpadding="2" cellspacing="2" >
                <tr>
                    <td width="140px">Account ID</td>
                    <td><asp:TextBox ID="txtAccount_Id" runat="server"/></td>
                    <td width="20px"><asp:RequiredFieldValidator ControlToValidate="txtAccount_Id" Display="Dynamic" CssClass="validate" Text="(*)" ValidationGroup="GroupValidate" runat="server" /></td>
                </tr>
                <tr>
                    <td>Full Name</td>
                    <td><asp:TextBox ID="txtFull_Name" runat="server"/></td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td>Organization</td>
                    <td><asp:DropDownList ID="ddlOrganization_Id" runat="server"/></td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td>Description</td>
                    <td><asp:TextBox ID="txtDescription" runat="server"/></td>
                    <td>&nbsp;</td>
                </tr>
            </table>
            <div style="text-align:center; width:100%; color:Red"><asp:Label ID="lbError" runat="server" EnableViewState="false"/></div>
        </asp:Panel>
        <div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
            <div class="ui-dialog-buttonset">
                <asp:Button ID="btnSave" CssClass="btn" runat="server" Text="Lưu" ValidationGroup="GroupValidate" onclick="btnSave_Click" />
                <input type="button" class="btn" value="Đóng" onclick="$('#dialog1').dialog('close'); return false;" />
            </div>
        </div>
    </div>
</asp:Content>
